<template>
    <mescroll-uni
        ref="mescrollRef"
        @init="mescrollInit"
        :height="height"
        :down="downOption"
        @down="downRefresh"
        :up="upOption"
        @up="getData">
        <list-item v-for="(item, index) in datas" :key="index" :item="item"></list-item>
    </mescroll-uni>
</template>
<script>
import listItem from "./list-item.vue"
import { GetUserAddupActivityList } from "@/service/api/activity.js"
export default {
    props: {
        height: {
            type: String,
            default: "100px",
        },
    },
    components: {
        listItem,
    },
    data() {
        return {
            datas: [],
            param: {},
            downOption: {
                use: true,
            },
        }
    },
    mounted() {
        //#ifndef MP
        this.refresh()
        //#endif
    },
    methods: {
        //获取列表数据
        getData(page) {
            let param = {
                searchKey: "",
                startTime: "",
                endTime: "",
            }
            param.pageSize = page.size
            param.pageIndex = page.num
            GetUserAddupActivityList(param).then((res) => {
                if (res.State == 1) {
                    this.datas = this.datas.concat(res.Data)
                    this.mescroll.endBySize(res.Data.length, res.RecordAmout)
                } else {
                    this.mescroll.endBySize(0, 0)
                }
            })
        },
        //刷新
        refresh() {
            this.downRefresh()
        },
        //刷新
        downRefresh() {
            this.datas = []
            this.mescroll.resetUpScroll()
        },
    },
}
</script>

<style lang="scss"></style>
